package com.tbit.main.aop;

import com.tbit.common.utils.TraceUtil;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * MQ消费者增强切面类
 *
 * <p>
 * 用于处理MQ消费者，消费完后进行清空TraceID操作
 * </p>
 *
 * @author <a href="mailto:zhang.zhiliang@tbit.com.cn">Zhang ZhiLiang</a>
 * @version 1.0
 * @see <a href="http://adsl1.tbit.com.cn:21490/pages/viewpage.action?pageId=82182491">订单号规范</a>
 * @since 2024/5/9
 */
@Aspect
@Component
public class MQAspect {

    @Pointcut("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
    public void afterMQConsume(){}

    @After("afterMQConsume()")
    public void cleanTraceId(){
        TraceUtil.cleanTraceId();
    }
}
